<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.2.1.js"></script>
    <script src="js/jquery.cookie.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        main{
            /*background: red;*/
        }
        article{
            background: skyblue;
            width: 500px;
            height: 200px;
            margin: 100px auto;
            text-align: center;
            padding: 25px;
        }
    </style>
</head>
<body>

<main>
    <h1>shiro分离式测试</h1>
    <article>
        <p>user:</p><input type="text" name="userName" id="userName"><br>
        <p>pass:</p><input type="text" name="passWord" id="passWord"><br><br>
        <button id="submit">登陆</button><br>
        <script>
            $(function () {
                $("#submit").click(function () {
                    var data={"userName":$("#userName").val(),"passWord":$("#passWord").val()};
                    console.log(data);
                   $.post("http://localhost:8080/fenlilogin",data,function (data) {
                       if(data.code == 1){
                           $.cookie("token",data.data);
                           window.location.href="fenlimain.html"
                       }else{
                           alert(data.tip)
                           // console.log("error");
                       }
                   })
                });


            })
        </script>
    </article>
</main>
</body>
</html>